#pragma once

#include "oisinclude.h"


//
//pattern:	ADAPTER
//
class InputMgrImpl : 
	protected OIS::KeyListener, 
	protected OIS::MouseListener, 
	protected OIS::JoyStickListener
{	

private:
	//static
	static const char *g_DeviceType[6];

	InputSys* const inputSys;

	OIS::InputManager	*	_InputManager ;	//Our Input System
	OIS::Keyboard	*		_kb  ;				//Keyboard Device
	OIS::Mouse	*			_m   ;				//Mouse Device
	std::vector<OIS::JoyStick*> _joys;	//joystick controllers

public:
	InputMgrImpl(InputSys* const inputSys);
	~InputMgrImpl(void);

	void init(const PlatformData& pdata);
	void shutdown();
	void captureInput();

	String getAsString(InputKeyCodeEnum keyCodeEnum);
	
protected:
	//OIS listener
	virtual bool keyPressed( const OIS::KeyEvent &arg );
	virtual bool keyReleased( const OIS::KeyEvent &arg ) ;
	virtual bool mouseMoved( const OIS::MouseEvent &arg );
	virtual bool mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
	virtual bool mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
	virtual bool buttonPressed( const OIS::JoyStickEvent &arg, int button );
	virtual bool buttonReleased( const OIS::JoyStickEvent &arg, int button ) ;
	virtual bool axisMoved( const OIS::JoyStickEvent &arg, int axis );
	virtual bool povMoved( const OIS::JoyStickEvent &arg, int pov );
	virtual bool vector3Moved( const OIS::JoyStickEvent &arg, int index);

private:
	//event conversion
	InputMouseState convert(const OIS::MouseState& oisMouseState)const;
	InputJoyStickState convert(const OIS::JoyStickState& oisJoyState)const;
};


